package com.aidex.system.controller;

import java.util.List;
import com.aidex.common.annotation.Log;
import com.aidex.common.core.domain.R;
import com.github.pagehelper.PageInfo;
import com.aidex.common.core.page.PageDomain;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.aidex.common.enums.BusinessType;
import com.aidex.common.utils.poi.ExcelUtil;
import javax.validation.constraints.*;
import org.springframework.web.bind.annotation.*;
import com.aidex.common.core.controller.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import com.aidex.system.domain.VCsisBusinessRelease;
import com.aidex.system.service.VCsisBusinessReleaseService;

/**
 * 国内放行数据Controller
 * @author wll
 * @email wll
 * @date 2021-10-14
 */
@RestController
@RequestMapping("/system/vCsisBusinessRelease")
public class VCsisBusinessReleaseController extends BaseController
{
    @Autowired
    private VCsisBusinessReleaseService vCsisBusinessReleaseService;

    /**
     * 查询国内放行数据列表
     */
    @PreAuthorize("@ss.hasPermi('system:vCsisBusinessRelease:list')")
    @GetMapping("/list")
    public R<PageInfo> list(VCsisBusinessRelease vCsisBusinessRelease, HttpServletRequest request, HttpServletResponse response)
    {
        vCsisBusinessRelease.setPage(new PageDomain(request, response));
        return R.data(vCsisBusinessReleaseService.findPage(vCsisBusinessRelease));
    }

    /**
     * 获取国内放行数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:vCsisBusinessRelease:query')")
    @GetMapping(value = "/{id}")
    public R<VCsisBusinessRelease> detail(@PathVariable("id") String id)
    {
        return R.data(vCsisBusinessReleaseService.get(id));
    }

    /**
     * 新增国内放行数据
     */
    @PreAuthorize("@ss.hasPermi('system:vCsisBusinessRelease:add')")
    @Log(title = "国内放行数据", businessType = BusinessType.INSERT)
    @PostMapping
    public R add(@RequestBody @Validated  VCsisBusinessRelease vCsisBusinessRelease)
    {
        return R.status(vCsisBusinessReleaseService.save(vCsisBusinessRelease));
    }

    /**
     * 修改国内放行数据
     */
    @PreAuthorize("@ss.hasPermi('system:vCsisBusinessRelease:edit')")
    @Log(title = "国内放行数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public R edit(@RequestBody @Validated VCsisBusinessRelease vCsisBusinessRelease)
    {
        return R.status(vCsisBusinessReleaseService.save(vCsisBusinessRelease));
    }


    /**
     * 删除国内放行数据
     */
    @PreAuthorize("@ss.hasPermi('system:vCsisBusinessRelease:remove')")
    @Log(title = "国内放行数据", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R remove(@PathVariable String[] ids)
    {
        return R.status(vCsisBusinessReleaseService.deleteVCsisBusinessReleaseByIds(ids));
    }


    /**
     * 导出国内放行数据列表
     */
    @PreAuthorize("@ss.hasPermi('system:vCsisBusinessRelease:export')")
    @Log(title = "国内放行数据", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public R export(VCsisBusinessRelease vCsisBusinessRelease)
    {
        List<VCsisBusinessRelease> list = vCsisBusinessReleaseService.findList(vCsisBusinessRelease);
        ExcelUtil<VCsisBusinessRelease> util = new ExcelUtil<VCsisBusinessRelease>(VCsisBusinessRelease.class);
        return util.exportExcel(list, "vCsisBusinessRelease");
    }

}
